Regrouped functions, and made the (currently limited)  interface to the DB more explicit. Resolved #2