many fixes to the grid and vertical margins

changed so much that I lost track