Refactoring function outputHtml
Fix thumbnails and hiperlinks