Make registry builder more robust and performant