Small changes

The algorithm is correct, as far to my knowledge. Sent a email to Dr.
Yampolskiy asking him a few questions. I made to make a few changes
after his response. Adding graphical feature to the program.