add some comments
implement functions and add comments