update: move factor into main.c

other: add more comments, can be used by report