Added comments and made small fixes