improved handling of functions and constructors.