Testing part1: added more test cases. fixed minor display message bug.
refactored codes