Modified logic to properly return values not found