Remove recursion for lookup()