almost done implementing object matching function