ms3 code sharing and improvment