fixed rotation bug and moved lots of cruft to tests