Simplified the toggle function