Elem is a type variable. Also added double param list to lambdas