Made some refactorings.
Improved support for colors.