Crazy css and html refactor for flex