Performance improvements for #1553