refactored jacquard.py