change variable name $location to $name to fit the original code