update api to be in separate file for better maintainability