refactoring around Function
refactoring around Function::ReturnIterator
updated test scripts