separate out protocol processing to a callback handler