Finished code for handling schemas