improved remove handler.