Refactor schema maintenance and add wide model support