Improve window behavior