Finish some cleanup, c++ streams and constification and add the frame printing from the C version.
Merge pull request #3 from danielhams/master

Finish some cleanup, c++ streams and constification + frame printing from C version