Changed function declaration to work with dash

    As it turns out, some shells don't accept the `function` keyword