added functions code and decode