Added XML parser and optimized for speed