moved threading operations to separate file