Refinements to REGEXs of all handlers, other minor refactoring