Refactored API into own file