Made further changes to logic; about to convert local db to pg to try export technique