Handling circular references and scope watches.
Adding comments; refactored code a little.