Refactor torrent.update_state