Create torrent type and refactor code