Match the spec properly

Fixes #1 and #2.
This isn't necessary; the original is functionally equivalent and imo reads more clearly.