Added support for functions and dynamic contexts. Improved work with constant pool