added join and refactor