modified function.cpp
merge with Boris