Extracted grid and added basic tests