Refactored armoryd.py, needs testing