Added better bsd/darwin support