Added libmagic wrapper for encoding detection
Changed the way tags are loaded.