add implementation for the rotate method