another optimization to rotate simplifying the code.