Removed the windowListeners and used a windowAdapter instead to reduce code
Resolcing conflicts