Add decode class, but still some bugs.