Refactored account saving.