On the mechanism of kerogen pyrolysis