Moved crate functions to a separate class. Fixed broken file previewer