Fixed incorrect behaviors rotating screen (geocoding was auto-triggered
and app crashed if rotation occured when a task was running). Also
organized some code.