Use encode instead of decode