refactored Window slightly