- fixed bug in simplify algorithm.
-added code to get expected behavior of printf on windows systems