the intermittent way in which the pains came on , causing him to writhe like a worm on a hook , then passing off , gave me a good idea that what troubled him was simple flatulence , but best to be thorough .