Merge pull request #679 from lovmoen/master

Removed cumbersome callback API for serialization. Cleaned up style.