Merge Tim's PR and update some scripts