added is rotation algorithm