changed mapping encoding to sort stuff lexically, as per spec

fixes #5