adding input checking for lookup func.