Replace st_creategrid by makegrid and improve it