Refactoring optional XML handlers to reduce startup time, code duplication