Added bencode function.