refactoring API into its own module