First cut at cleaning up and documentation