refactor window