implemented proper linked list