need to commit more often. Added data persistence.