Add saving to DB
Refactor and finish up read-from-db