Window setup code