Detect application more intelligently