added color thresholds and squashed bugs