assign2 hw

added comments and functionality to cached scope function