Refactor to remove group stack and fix coloring
Merge pull request #403