Refactor photobrowser (using events)