Refactored grid and added new functionality