Fixed major bug in cleanDB; simplified architectue.