Refactored window class