refactored core namespace, created sql namespace

a few other clean up functions.  this feature branch was a hold-over from ecohack.  now able to engage according to standard git protocol.