Moved location / directoin logic to a place that makes sense.