refactor to join