Added n1, n2, and n3 to the Grid class and updated other functions to
use them where appropriate.