refactored
implement AsyncTask and added tests for it