encode storage as integers