Rewriting Database class; code cleanup ++