The comments are a little unclear -- by "#Get the hive(HKLM)" are you really saying "Get the hive component of the registry key path"?  If so, it might be clearer if you give a comment saying something like "paths are in the form x\y\z, and we will obtain the x and y components of the path" or something to that effect.