Refine previous algorithm to find the aspect ratio.