Added discovery code (UNTESTED)