refactored DynamicFunction to remove member variables