made schema loader a function