Refactor to remove group stack and fix coloring