Spot detection

Improved spot detection comments and functionality. Some new functions
for generating test images crept in too.