Improved lisnked list implementation