final refactor of joins