Refactored /accounts, database tests, and password storage