Moving API to its own file