adapts the function to take an object as a parameter