Fixed populate database deleting things error. Temporary fix.
Merged in the temporary fix to populatedb from origin/master
Lots of updates; still working on the more obscure functions