a bit of refactoring to prepare to write colors