Improved the log searching code.