Added handling of whitespaces with preserve option