Added color detection code