refactoring toggling status