basic encoder method is working now