major coloring refactoring plus added legends