rotate tool implementation, some minor bugfixes