Fist implementation, but accept the function can have just two variables