Refactored & improved affine align code
Finished affine alignment cropping, refactored more functions