Grid detection debugged.