cleaning up gantt chart code to reduce redundancy