Changed photoencoder.h to use the built-in counter class.