Moved API into library