Fixed count query; Added versioning to file name