implemented proper discover function