Added comments and other style improvements