reorganize code to supply schemas from API