Refactoring registry entry update code