added functions: average, concat, defaultIfEmpty, elementAt, elementAtOrDefault, empty, first, firstOrDefault, last, lastOrDefault, sum;
improved internal type safety