Improvement to winding function theory for PM machine analysis