zhang250 & zhou86: refactor and commenting

updated tests