Major refactor to modules essentially complete and working (local db access only).