refactoring to add color switching