refactored internal code and tests to use FunctionalReflection