Switched to ElementTree, tidied up formatting
Removed unused imports