added support for writing counts to a file