Removed hardcoding of image dimensions