refactor grid into a different file