Tighter implementation and a spec for it.