Forked and updated a selection of ports from: pitman