More efficient swatches getting algorithm.