Added base code for dealing with grid inputs