added some db stuff and torrent changes