major refactoring, added xml config