added threading abstraction layer; cleaned up