More marketplace.js refactoring