remove duplication in lookup function
remove duplication in lookup function