Added avg and sum sort modes