refactored with threading macro
refactored with threading macro