Added match function to dp.cc