Reading this code, it'd help to have a comment here indicating that `previous_klass` is expected to be overridden by subclasses.