Moving join function to utils
Improving test