work in progress -- doesn't all compile yet, but it is starting to take shape