First pass.
Initial working version (I think).