Added more useful error info. and add switch discover function
Merge