new version with full threading option