factor function for grid
can now scale bugfree
scaling is now linear