     // Configure the observation space.
     switch config.observationSpaceType {
     case .screen:
-      let screen = Environment.screen(
+      self.screen = Environment.getScreen(
         gameData: self.gameData,
         emulatorHandle: self.emulatorHandle,
         forPlayer: 0)
-      self.observationSpace = Box(low: 0, high: 255, shape: screen.shape)
+      self.observationSpace = Box(low: 0, high: 255, shape: screen!.shape)
     case .memory:
-      let memory = Environment.memory(gameData: self.gameData)
-      self.observationSpace = Box(low: 0, high: 255, shape: memory.shape)
+      self.memory = Environment.getMemory(gameData: self.gameData)
+      self.observationSpace = Box(low: 0, high: 255, shape: memory!.shape)
     }
 
     if let state = self.state {

    }
  }

  public func recordMovie(at url: URL) {
    movie = Movie(at: url, recording: true, numPlayers: numPlayers)
    movie!.configure(for: self)

    self.state = state
  }

  public func updateCachedScreen() {
    self.screen = Environment.getScreen(
      gameData: self.gameData,
      emulatorHandle: self.emulatorHandle,
      forPlayer: 0)
  }

  public func updateCachedMemory() {
    self.memory = Environment.getMemory(gameData: self.gameData)
  }

  private func updateCachedObservations() {
    switch config.observationSpaceType {
    case .screen: updateCachedScreen()
    case .memory: updateCachedMemory()
    }
  }

  private static func getScreen(
    gameData: GameData,
    emulatorHandle: UnsafeMutablePointer<CEmulator>?, 
    forPlayer player: UInt32 = 0
