cleaning up window code