Preliminary iteration of new framework

Various issues and problems and performance concerns, but in general
easier and better to work with. Note: will break previous clients