refactored code to accept statistics type calls