Changed input to better handle carriage returns.