split magic files

(sorry, previous PR wasn't able to merge)
this PR splits magic into multiple files