Still a bit sloppy,
Quick hack to make it export to XML + Refactored the library to a class.