Added comments and small fixes