added schema function and use of custom fields