utilize helper, fix some bug, make use of code block, update test cases