add output in percent to format function, fix some useless code