Redo the layout system to use CSS flexible boxes