window: More code cleanup