Use getmaxyx for scrSize.  Remove non-recommended approach of reading LINES and COLS global variables.