Configuration + testing

Added option to use own .xml for configuration and refactored some
stuff.