trim newline on input so we handle blank lines nicely