Non-Markovian epidemics