Slight reorganization, implementing selection of handler