utility functions for encoding and decoding from slices, fleshed out readme