refactor to be more generic. less intrusive in the HTML