Matrix layout changes and some margin corrections