basic logic for coloring works