Refactored to make the interface to the API wrappers more generic