seperate thread for logic control