Added automatic saving and loading of database