Added autorotation support; deleted some old methods and updated the code to the latest tutorial version.