Use bash as sh doesn't seem to support functions