changed variable to maxwidth, maxheight