Modularizing Counterblockd functionality & plugin interface for third-party modules

Cleaner version of #79. Also started on some tests,
What the purpose of this file ?