fixing a math error

also reformatting output