refactoring to be compatible with new contents api