They spray foam insulation will work great. There are no problems with thsi method. As for the frayed electrical line, if you can access it well enough, just wrap some electrical tape around it before using the spray foam.