adjusted getGrid method