Refactored database structure, completed imap account storage