Final functionality update
Added useful comments to code