Generic Sorted list implementation