Adding locking functionality to Linked List