Factored out bunch of stuff to mtconfigf and mtcommon in src.