Make API into a class.