some progress, cleaning up encoding (doesn't compile)