Incorporate various nits from till and dvander reviews
rename f to func in some cases
rename f to func in the rest of the places