refactoring html creation in preparation of subplots