refactoring of media queries and general cleanup