Made the function to a plugin