Added scaling logic, that allows the window to be resized to any shape.