Refactored set dynamic body logic