decode functions moved to the prototype