clean up and compat fixes

fixed some functions to be compatible with this cms and did some cleanup to make it more streamlined.