ls.cpp modified