Added control thread and initialization of references