Added comparator function
Updated implemented functions