refactored. use templates for color and image