improve http event processor code