refactor networking code to photocontroller class