Refactored window manager