move some static code from Window into a utility class