Refactor flexbox