Improved host ViewController detection algorithm