Back to having a separate routine for window and non-window operation