implement rotate method