refactor window action