Added matchInPlace. Refactored.