Made counterclockwise routine a function