refatored to centralize the account management stuff and also prepared to implement the registration functionality