fix the code to match the spec

While still failing for demo purposes, of course.