Added comments to most of the stuff, fixed up some of the parts of the framework.