Refactored extraction and printing