added possible solution to determine terminal width