cleanup and fix resizing/viewport bugs