restructure the API