You also need to define functions <i>before</i> calling them.
Also, one function is enough to do the conversion.