better slice resetting, cookie encoding for better storage