refactor aspect ratio preserving code into a subclass