moved Which and lf to functions