Added color rendering function and legend control