Many comments and tidyups. Email bug.
rename theme from ccms to avoid conflicts and some code tidyup