Refactored, now using xcrun, input/output now in tmp files