Set up dual PWMs on timers 0 and 2.
Added bailout for initial input capture so it wouldn't stick there forever.
Renamed some variables for clarity.
Added more comments for clarity.