Refactored dynamic clients script