Code updated and explanations added

Code variables changed to reflect my deeper understanding of what
exactly is happening when the functions are executed.
Extensive notes made in the program on this basis