Add comment
reorganize code
Correct some display bugs