Flares in gamma ray bursts