Refactoring in BEncode.hs