added rotation handling