Refactoring

Cleaned up the code and made the xml more unified