refactored color code