add comments and some improvements for tests