Improves the logic to find the previewed item
Refactorr, add module pattern