Could we move these subroutines of `decode()` after `decode()` for readability?