Move API functions to classes and add wrappers