delete ugly bash version, add comments checking, and fix some bugs