Migrating to dictionary, fixing all functions to work with dicts, savings emails to files