Use join instead of the loop

Shorter, faster and less hacky.