fixing up code

Adding comments and such.