refactoring of less code and small improvements in media queries