rewrite rotate_sides