Added some test and fixed rotation.