fixed bugs in thumbnail creation; cleaned up code

See commit comments. Had to fix when I was calculating the capture times. Tested, works great!