Make XML valid
Fix instance variable issues and format regex