Refactor to return the result