Added things for serialization, changed the database saving and reading
and bug fixes