adding rotation logic