Moved InvocationEnvironment to the public API and removed unused code.
Minor renaming.