First iteration of the decode function works