Reformat functions to more portable form
Use  to capture output rather than back ticks