Moved api functions inside a class