Implemented setViewportSize and stabilized tests