refactoring, working config reader for json/php

Big shuffling of files and namespaces, lots of documentation and the
working reading of JSON and PHP configs.