Refactor dispatcher

Fixes https://github.com/etobi/ext-coreapi/issues/34