Fixing bug with trailing returns in input mentioned by Mark Scott