split plugin loading into it's own module and did some fixes.

Signed-off-by: Miethpo <miethpomail@yahoo.co.uk>