Fix rotation direction and replace pi constant with Math.PI