Grid Refactor

Also perfected the state machine on the index/doc page