changed parser from RE-based to DOM-based