MIFOSX-342: bring in work from yanna with some modifications.