Modified DB to only persist changes to the DB for performance.
Removed dead code and debug statements