Refactor rows decoding