small window code refactor