content management js refactoring