Changed request handlers from pointers to local functions to a function class, so that request handlers can have retained state.