Imported changes to wait from m-c