You don't need to use the class pattern for this. Just adapt the function to take an object as a parameter.