First functional pass

TODO
Clean up foundation cruft
Write tests
Fix layout