refactored CMS to use castle