computing the fractional counts is a nicer way.. but needs 2 more loops