Help creating an adjustable grid in grasshopper

Hi all,
New grasshopper user here, I’m about 15-20 hours in following tutorials and building some of my own definitions.

My goal is to creat a grid with the following functionality:

  1. Create adjustably spaced grid lines x & y direction with individual inputs (I have gotten this far, although it may not be the neatest / simplest solution)

  2. Be able to add additional gridlines in the x and y direction with an input. When additional gridlines are added, their spacing is also able to be edited.

Im not sure if this is even possible so any guidance would be helpful. Please see the attached files for reference.

Grid_1.gh (10.7 KB)