Remove use of deprecated APIs

Also add a spec.
I like it.