Rework slice to normalize slice writing and avoid code duplication