Added tests and fixed rotations