Cleaning up plugin functions