refactored matchMedia polyfill