Add helper functions for decoding