added Decode function