Added encode option