Added comments, fixed asserts