clear more debug code
add a protocol for more extensible dispatch