Using longs for all counting associated values. Minor code cleanups