Added fix for counts. Code is now working as expected.