added in conditional functionality to config json

... as well as some more error handling.