Move decode to utils.