Modified AsyncTask to be able run with multiple iterations.