Devided handler() method to open()
Fixed problem: losing current state when window was resized