Updated so it can be compiled with Apple LLVM compiler.