refactored photo code. Uses config file