Finalized rewrite of roles, users and preferences