sample - right merge with dom
some optimizations