Code cleanup. Extract coloring functions to their own file