add function for printing grid