Added comments, removed dead variables added type check for non-images, #363.

Signed-off-by: Zane M. Kolnik <zanematthew@gmail.com>