Structural Phase Transitions in Layered Transition Metal Compounds