Fixed issue with constants, refactored grid_check method.