CMS's ugly code