Streamline variable expansion
Refactored according to review and fixed wrong line number in message