more safety and refactoring. nothing added. next up is to write an xml loader that handles malformed xml file and silently log the error elsewhere but not throwing cold hard exceptions.