Changed entity lookup to consider name and regid
Added and restructured tests