changed bitencoding to order dictionary by first bit found