Added functionality to the lookup function.