Improved search and replace logic for updating version.