Cleaned up decoding method