Consolidate into one function, add raw_html input option, returns raw_html