Tidy up code + better aspect ratio calculation + 90% image compression during save to reduce output file size