Implemented row matching. Needs refactor