Add libmagic to build process and some cleanup