General refactor of dispatcher, param encoder, and response