complete grid implementation