Fixed api bug in publish
Starting to add unit testing.  Bug fixing.