Cleaning up matching function in main module.