Better errors, some refactoring
Refactor xml parsing
refactor instantiation