improve grid drawing