More advanced toggle support + Refactoring