Fixed flagging bug. Added toggle_flagging functionality.