Enhanced flexible algorithm for the optimization of slot filling factors in electrical machines †