Added template argument for Comparator function