modified to handle view controller smaller than screen size