made api into a module