I've streamlined and improved the replacing functionality.