Added comments and fixed a few things.