made grid structure more generic