cout is replaced by log file
Little refactoring of decoder.