refactor with custom color functions and comments