Added some basics for gridnav.
Also added a global Brainworks message definition.
Also fixed some potential out of bounds errors.