Documentation and a bit of cleanup.

Added documentation for non-trivial logic in Contexts, Phases and
TreeTransforms.
Removed redundant vars and casts
Merge pull request #105 from DarkDimius/docs

Documentation and a bit of cleanup.