Cleaned up patch to be OS/compiler agnostic and touch less of the file