refactored api into separate module