Fixed major stack corruption bug, added rotation functionality (broken)