implement rotation
add test suite and fix errors