added comments and fixed a few other things