added data decoding; optimized decoding