Improve method of detecting if running in screen