made some changes to adapt to mx