slice decoding refactoring