Rewrote window creation code in OOP fashion