Major refactoring, added tracking of torrent files and fixed updating of torrent status.