color classifier rewritten