Tidyup of decoder