changed single linked list to use generics