fix index error
better printResult, comments