Modified to encode the location value