yet another try at encoding