Clean up of window code
Clean up of window code