complete rewrite with no deps and compressed file support