Updated newline without insert mode because original solution did not work for terminals