implemented --total option