General refactoring of the Function subclasses.