Fixed refactoring issues in threaded version of spire.