modified list.cpp