Did more work on groups, refactored most of auth code