refactor result return