[Code Style]Clean up libraries/cms. Fixes #4593. Fixes #4596. Fixes #4598. Fixes #4599. Fixes #4602. Fixes #4604