Implement window logic into separate class