#405 Corrected return type
#405 Moved creating schema to function