using implode instead of foreach