Add 'leave group' functionality. Includes other bug fixes.