wrote basic joinentwork function