Correctly issue the pkg add command to actually install things. Also simplify a bit the code.