Match the spec properly

Fixes #1 and #2.