Added some handling for rotations... messy.