Worked on decode function.