Added namespacing and DEBUG.  Cleaned up a few things.