Adding some missing files after merging code from Qi Ma.