converted script into plugin