Added control for threads