cleaned up the cxx code a bit, added code to make plots