refactored code

Working on windows compatibility.  Refactored for faster overall
execution.  Executing 100% faster.
Windows compatible

Refactored code so that it can run on windows.