1. Everything is documented and doctested.

2. Corrected a bug that could lead to an infinite loop.

3. Several functions renamed to begin with underscore to prevent
namespace pollution.

The alternate coloring doesn't work if there are at least 3
different images.