refactor plugin registration