refactored slice creation