refactored grid initialization for proper cell coordinates