Changed code structure to better suit algorithm structure in
Sutton's book
# Not tested yet.