Put everything together.

This version compiles but doesn't work.