Updated to support compiling with MSVC - changed float to double, bool to int, several C89 fixes