Added flush schema and XML generation code