Refactor grid layout and margins