Allow for multiple schemas, also added error checking