Refactored such that SamplePreview is its own class with control element and dom element.