refactor to return empty array but not memozie that result