Added quality variable and updated rotate function