cleaned up join/leave functions