Handle logic for removing trailing newlines in MMTask.