improve dom parsing + tests