Fixed spacing issue in layout alg