implement dup flag management (in progress)
Improve the code appearance, and fix one TODO about suback