cleaning up contentmanager

Added doc-strings/comments and made the code cleaner.
Also added tests.