PERF: security checks added for every string manipulation.