Lots of similar modifications to make rotation and iOS7 work (#5 and #6)