added rotation 'algorithm'