Refactor for asynctask control