Simplified the joining code