bugs, typos, logic refinement