This line has 'rotation' in it 3 times.  I think it would be clearer with a plain old if statement.