Fix syntax bugs, change rotate to be dynamic