updated ls.cpp to support two events, with and without flags