A non-working sketch of the rest of the implementation.