refactor code for asynvtask