added threading func and pickling to settings