updated version of viewFrames with more robust resizing