added handler to change window