refactored FunctionManager. in the process of refactoring DataManager.