Refactoring code and making overiding simpler for window creation.