comment format change, restructure some functions