implemented first that takes function as second argument