added variable grid size feature
adding some comments, cleaning some things