another try at encoding