Updated to comply with the latest CMS API