fixed xml formating issues and small code bugs