Merged from Tai and some other modif