improved logic of AsyncTasks