Close GH-6: implement toggle function. Fixes #1