change plugin registration to a more generic way

fixes #5 and superseds #4