final touches - added comments and tested a few more times