shuffle quickedit code to get it reusable (a bit)