Added comments and cleaned away junk code a bit.