Refactoring grid code

Rewriting the fluid grid to allow for complex nesting of elements.