Major code restructuring

Plugin needs to run in on a seperate thread, allows multiple requests to
be dispatched at once.