seperated code for Looper Thread