organize code. Resolve color plotting bug.