Use dynamic records subset for compound encoding
Refactoring of compound encoding/decoding