Code cleanup in Registry and String