Cleaned some window management related code.