replace repetitive code in add_buttons_to_dom by five calls to a local function add_button