Updated to work on non-Unix machines.

Removed implicit type conversions in logic.