fix compilation warning in Grid.hpp and prettify its code