color_gen call added and redundant code removed