2nd phase was done on the unrotated version of the input image, now corrected