moved the database queries off the UI thread