HTML template builds and api call refactoring