photo code cleanup