remove debug code
change to run on background thread