cleaning up some code and adding summary figures