add some comments in code
improve tests