terrible mistakes corrected
comparision of my vs tonya's algorithm