added coloring algorithm