more repackaging
introduce Grid class, modify everything to work with that