restructured how data is stored and accessed in the database (again) build_pkg.py is working. Logging fixed.