attempting to refactor so that code will compile under Linux/MacOSX again.
missing files
building under OSX and usable to some degree