Turned the schema into a function rather than a hook, suggested by Mike