refactored window assignment