added option for maintain aspect ratio