fixed the rotation. clean up code