Starting to add ability to resize the window

Also did some refactoring