refactor toggle