Fixed bug in encoding (not sorting keys), started work on torrent client