First part of attempt to fully implement support for changed viewport