Bike died at Intersection
So last night I was riding home and I started to have some issues. About half way home (about 10 miles on the bike) the engine started to stutter causing random RPM spikes, from about 4k to 6k, and a really rough ride, at the same time the lights on the bike would all dim. If I revved the engine up a bit higher, it would seem to clear up for a minute before starting up again, or if i shifted to a higher gear it seemed to give me a few minutes of problem free cruising. As I was about 5 minutes from home I started braking as i came to an intersection all the power on the bike just completely cut out and the bike died.
I've already checked the battery and it has come up fine so I'm really looking for where else I should start looking to figure this out.