Minor fixes, still testing encoding.