Function update_window() added