added comments, updated tests