improve WeaponFactory code