flexbox complete rewriting