Fixes infinite rotation bug, plus other misc bug fixes and tweaks