Add test for subdirectories and better encoding