More duplicate code removal and caught a link_to in a button_to function