Added name checking
Refactored grid