Added the discard function for fragments.