Whitespace and lint cleanup. Using named functions for stacktrace benefits. Adding comments. Minor cleanup and refactor for easier reading.
Fix to parse style rules within media queries