add comments, fix range query support