Made encode a function
stupid git