Added toggles, refactoring a little