This should be in an asyncTask.