Added possibility to color lines. Also did some refactoring.