Refactored to have API