Moved some Marketplace functions from htdocs to theme