finish rotate function
finish rotate function