move logic from router to window_manager