work on #17
add comments
fix minnor bugs