added window resizing (buggy)