changing a couple index of calls to lastIndex of for logistical reasons (i.e. if a something.something.somthing.js file is saved, it will use everything up to .js as the name instead of stripping off everything after the first . found)