splitting refset functions for encoding and decoding.