generalise input stream type
rearrange combinators into more sensible order