A bit of cleanup

I took out some of the unnecessary code and added a few comments.