Improved rotation of rectangle and addded auto test of CR