update spec to new style

The code is much cleaner and DRYer. Most of the changes to reflect the
new convention are pretty obvious.