Refactored for async - no file writing