refactored marccount and added tests