modifications after first testing of the algorithm
FOR equation partially processed. Added print function to see the results