refined media queries and refactor