cleaned up and prepared framework for more general CMS setup