Adds thread functionality.