Code cleanup and quick match history fix