General clean-up and made it work with newest openphoto-lib.