Modified main file from PMSM