Replace encode with decode