Implemented some kind of plugin api. Closes #44.