Added match option and refactored tests.