diff --git a/.config/lf/lfrc b/.config/lf/lfrc
index 0e94c159..6dc251d4 100644
--- a/.config/lf/lfrc
+++ b/.config/lf/lfrc
@@ -13,33 +13,23 @@ source "~/.config/lf/shortcutrc"
 
 cmd open ${{
   case $(file --mime-type "$(readlink -f $f)" -b) in
-	application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
-	image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
-  text/*|application/json|inode/x-empty) $EDITOR $fx;;
-	image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
-	image/svg+xml) display -- $f ;;
-	image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" |
-		setsid -f sxiv -aio 2>/dev/null | while read -r file; do
-			[ -z "$file" ] && continue
-			lf -remote "send select \"$file\""
-			lf -remote "send toggle"
-		done &
-		;;
-	audio/*) mpv --audio-display=no $f ;;
-	video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
-	application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
-	application/pgp-encrypted) $EDITOR $fx ;;
-  *.tar.bz|*.tar.bz2|*.tbz|*.tbz2|*.tar.gz|*.tgz|*.tar.xz|*.txz|*.zip|*.rar|*.iso)
-    mntdir="$f-archivemount"
-    [ ! -d "$mntdir" ] && {
-        mkdir "$mntdir"
-        archivemount "$f" "$mntdir"
-        echo "$mntdir" >> "/tmp/__lf_archivemount_$id"
-    }
-    lf -remote "send $id cd \"$mntdir\""
-    lf -remote "send $id reload"
-    ;;
-  *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
+  	application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) localc $fx ;;
+  	image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;;
+    text/*|application/json|inode/x-empty) $EDITOR $fx;;
+  	image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;;
+  	image/svg+xml) display -- $f ;;
+  	image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" |
+  		setsid -f sxiv -aio 2>/dev/null | while read -r file; do
+  			[ -z "$file" ] && continue
+  			lf -remote "send select \"$file\""
+  			lf -remote "send toggle"
+  		done &
+  		;;
+  	audio/*) mpv --audio-display=no $f ;;
+  	video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
+  	application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
+  	application/pgp-encrypted) $EDITOR $fx ;;
+    *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
   esac
 }}
 
diff --git a/.config/lf/pistol b/.config/lf/pistol
deleted file mode 100755
index 3f37aee2..00000000
Binary files a/.config/lf/pistol and /dev/null differ
diff --git a/.config/lf/preview b/.config/lf/preview
index ed9465a6..652c83f4 100755
--- a/.config/lf/preview
+++ b/.config/lf/preview
@@ -15,7 +15,12 @@ video() {
     h=$3
     x=$4
     y=$5
-    kitty +icat --silent --transfer-mode file --place "${w}x${h}@${x}x${y}" "$(~/.config/lf/vidthumb "$file")"
+    thumb="$(vidthumb "$file")"
+    if [ "$thumb" != "" ]; then
+      kitty +icat --silent --transfer-mode file --place "${w}x${h}@${x}x${y}" "$thumb" 
+      exit 1
+    fi
+    mediainfo "$file"
     exit 1
 }
 
@@ -34,60 +39,35 @@ batorcat() {
 CACHE="$HOME/.cache/lf/thumbnail.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | awk '{print $1}'))"
 
 case "$(printf "%s\n" "$(readlink -f "$1")" | awk '{print tolower($0)}')" in
-	*.tgz|*.tar.gz) tar tzf "$1" ;;
-	*.tar.bz2|*.tbz2) tar tjf "$1" ;;
-	*.tar.txz|*.txz) xz --list "$1" ;;
-	*.tar) tar tf "$1" ;;
-	*.zip|*.jar|*.war|*.ear|*.oxt) unzip -l "$1" ;;
-	*.rar) unrar l "$1" ;;
-  *.md) glow -s dark "$1" ;;
-	*.7z) 7z l "$1" ;;
-	*.[1-8]) man "$1" | col -b ;;
-	*.o) nm "$1";;
-	*.torrent) transmission-show "$1" ;;
-	*.iso) iso-info --no-header -l "$1" ;;
-	*.odt|*.ods|*.odp|*.sxw) odt2txt "$1" ;;
-	*.doc) catdoc "$1" ;;
-	*.docx) docx2txt "$1" - ;;
-  *.xml|*.html) w3m -dump "$1";;
-	*.xls|*.xlsx)
-		ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv
-		;;
-	*.wav|*.mp3|*.flac|*.m4a|*.wma|*.ape|*.ac3|*.og[agx]|*.spx|*.opus|*.as[fx]|*.mka)
-		exiftool "$1"
-		;;
-	*.pdf)
-		[ ! -f "${CACHE}.jpg" ] && \
-			pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"
-		image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
-		;;
-	*.epub)
-		[ ! -f "$CACHE" ] && \
-			epub-thumbnailer "$1" "$CACHE" 1024
-		image "$CACHE" "$2" "$3" "$4" "$5"
-		;;
-	*.cbz|*.cbr|*.cbt)
-		[ ! -f "$CACHE" ] && \
-			comicthumb "$1" "$CACHE" 1024
-		image "$CACHE" "$2" "$3" "$4" "$5"
-		;;
-	*.avi|*.mp4|*.wmv|*.dat|*.3gp|*.ogv|*.mkv|*.mpg|*.mpeg|*.vob|*.fl[icv]|*.m2v|*.mov|*.webm|*.ts|*.mts|*.m4v|*.r[am]|*.qt|*.divx)
-		video "$1" "$2" "$3" "$4" "$5"
-		;;
-	*.bmp|*.jpg|*.jpeg|*.png|*.xpm|*.webp|*.gif|*.jfif)
-		image "$1" "$2" "$3" "$4" "$5"
-		;;
-  *.svg)
-    [ ! -f "${CACHE}.jpg" ] && \
-      convert "$1" "${CACHE}.jpg"
-    image "${CACHE}.jpg" "$2" "$3" "$4" "$5"
-    ;;
-	*.ino|*.c|*.php|*.py)
-		batorcat "$1"
-		;;
-	*)
-    ~/.config/lf/pistol "$1"
-		;;
+  *.md) glow -s dark "$1"  && exit 0 ;;
+  *.xml|*.html) w3m -dump "$1" && exit 0 ;;
+	*.[1-8]) man "$1" | col -b && exit 0 ;;
+	*.o) nm "$1" && exit 0 ;;
+esac
+
+case "$(file -bL --mime-type $1)" in
+  application/gzip) tar tzf "$1" ;;
+  application/x-bzip2) tar tjf "$1" ;;
+  application/x-xz) xz --list "$1" ;;
+  application/x-tar) tar tf "$1" ;;
+  application/zip) unzip -l "$1" ;;
+  application/java-archive) unzip -l "$1" ;;
+  application/x-rar) unrar l "$1" ;;
+  application/x-7z-compressed) 7z l "$1" ;;
+  application/x-iso9660-image) iso-info --no-header -l "$1" ;;
+  application/x-bittorrent) transmission-show "$1" ;;
+  application/vnd.sun.xml.writer) odt2txt "$1" ;;
+  application/msword) catdoc "$1" ;;
+  application/vnd.openxmlformats-officedocument.wordprocessingml.document) docx2txt < "$1" ;;
+  application/vnd.ms-excel) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv  ;;
+  application/vnd.openxmlformats-officedocument.spreadsheetml.sheet) ssconvert --export-type=Gnumeric_stf:stf_csv "$1" "fd://1" | batorcat --language=csv ;;
+  application/epub+zip) [ ! -f "$CACHE" ] && epub-thumbnailer "$1" "$CACHE" 1024; image "$CACHE" "$2" "$3" "$4" "$5" ;;
+  application/pgp-encrypted) gpg -d -- "$1" ;;
+  image/*) image "$1" "$2" "$3" "$4" "$5" ;;
+  video/*) video "$1" "$2" "$3" "$4" "$5" ;;
+  *opendocument*) odt2txt "$1" ;;
+  text/*|*/xml|application/json) batorcat "$1" ;;
+  */pdf) [ ! -f "${CACHE}.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE"; image "${CACHE}.jpg" "$2" "$3" "$4" "$5" ;;
+  *) mediainfo "$1" || exit 1 ;;
 esac
 exit 0
-
diff --git a/.config/lf/vidthumb b/.local/bin/vidthumb
similarity index 89%
rename from .config/lf/vidthumb
rename to .local/bin/vidthumb
index 878e9685..72143d0b 100755
--- a/.config/lf/vidthumb
+++ b/.local/bin/vidthumb
@@ -1,10 +1,11 @@
 #!/usr/bin/env bash
+# Script to generate thumbnails for lf
 
 if ! [ -f "$1" ]; then
 	exit 1
 fi
 
-cache="$HOME/.cache/vidthumb"
+cache="${XDG_CACHE_HOME:-$HOME/.cache}/lf"
 index="$cache/index.json"
 movie="$(realpath "$1")"