add factors
make output short and fix bugs
use config to decide whether loop