Desperate attempt at having only one thread running at a time