added comments, fixed failing test