completed. added notes on how to debug nested function operations of last line. also made easier to read