First version of lookup function done