Rebuild media query function

Rebuild to accommodate '-hide' and '-only' size classes properly in media queries.