Improve location detection and directive propagation