Added AsyncTask and code cleanup