decode, and reduce memory usage