Refactoring out Core Module code

Most refactoring complete.  Need to fix up the tests and benchmark code.
#1 #2 #7