refactoring msot of the publications code