discard controller refactored