Refactors signin and assignment of roles.