Added correct rotation and improved performance