Added swatch generation function. Simplified variables