Improve viewport width implementation